/* 
 * Copyright 2014 ShangDao.Ltd  All rights reserved.
 * SiChuan ShangDao.Ltd PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 * 
 * @ActShare.java  2014-9-11 下午2:18:38 - Carson
 * @author Guzhu
 * @email:muyi126@163.com
 * @version 1.0
 */

package com.android.tiango.baba.act;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;

import com.android.scsd.tiango.R;
import com.android.tiango.baba.BaBaseActivity;
import com.android.tiango.baba.util.SocialUtils;
import com.android.tiango.baba.util.ToastUtils;
import com.android.tiango.baba.view.AppTitleBar;
import com.umeng.socialize.sso.UMSsoHandler;

/**
 * 活动结束
 * @author YW_pc
 * 
 */
public class ActShare extends BaBaseActivity implements OnClickListener {
	private TextView mJyTextView;
	private TextView mContentTextView;
	private TextView mSinaTextView;
	private TextView mSinatoastTextView;
	private TextView mQqzoneTextView;
	private TextView mQzonetoastTextView;
	private TextView mWfriendsTextView;
	private TextView mWfriendstoastTextView;
	private TextView mTiangouTextView;
	private TextView mTiangoutoastTextView;
	private SocialUtils utils;

	@Override
	protected void onCreate(Bundle arg0) {
		super.onCreate(arg0);
		setContentView(R.layout.layout_share);
		initView();
	}

	private void initView() {
		utils = new SocialUtils();
		mTitleBar = (AppTitleBar) findViewById(R.id.titlebar);
		mJyTextView = (TextView) findViewById(R.id.tv_jy);
		mContentTextView = (TextView) findViewById(R.id.tv_content);
		mSinaTextView = (TextView) findViewById(R.id.tv_sina);
		mSinatoastTextView = (TextView) findViewById(R.id.tv_sinatoast);
		mQqzoneTextView = (TextView) findViewById(R.id.tv_qzone);
		mQzonetoastTextView = (TextView) findViewById(R.id.tv_qzonetoast);
		mWfriendsTextView = (TextView) findViewById(R.id.tv_wfriends);
		mWfriendstoastTextView = (TextView) findViewById(R.id.tv_wfriendstoast);
		mTiangouTextView = (TextView) findViewById(R.id.tv_tiangou);
		mTiangoutoastTextView = (TextView) findViewById(R.id.tv_tiangoutoast);
		if (null != mTitleBar) {
			mTitleBar.setTitle("活动结束");
			mTitleBar.setImageBackGround(R.drawable.bg_title_blue);
			mTitleBar.setBackIcon(R.drawable.icon_back);
			mTitleBar.setMoreText("继续");
		}

		mSinaTextView.setOnClickListener(this);
		mQqzoneTextView.setOnClickListener(this);
		mWfriendsTextView.setOnClickListener(this);
		mTiangouTextView.setOnClickListener(this);
	}

	@Override
	protected void onActivityResult(int requestCode, int resultCode, Intent data) {
		super.onActivityResult(requestCode, resultCode, data);
		/** 使用SSO授权必须添加如下代码 */
		UMSsoHandler ssoHandler = utils.mController.getConfig().getSsoHandler(requestCode);
		if (ssoHandler != null) {
			ssoHandler.authorizeCallBack(requestCode, resultCode, data);
		}
	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.tv_sina:
			utils.setShareSina(ActShare.this, "新浪商品抢到了", "http://www.baidu.com", "新浪标题");
			break;
		case R.id.tv_qzone:
			utils.setShareQQZoe(ActShare.this, "QQ空间商品抢到了~", "http://www.baidu.com", "空间标题");
			break;
		case R.id.tv_wfriends:
			utils.setShareWeiXin_Circle(ActShare.this, "朋友圈商品抢到了~~~", "http://www.baidu.com",
					"朋友圈标题");
			break;
		case R.id.tv_tiangou:

			break;
		default:
			break;
		}

	}

	@Override
	public void onBackPressed() {
		ToastUtils.showMessage("请点击右上角的\"继续\"按钮");
	}
}
